﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using loveMotorcade.web.Models;
using System.Web.Mvc;


namespace loveMotorcade.web.Filters
{
    using Classes;

    public class loginFilter:ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (userC.isLogin != true) {
                if (filterContext.HttpContext.Request.IsAjaxRequest())
                {
                    filterContext.Result = myJson.error("需要登录");

                }
                else {
                    filterContext.Result = new RedirectResult("/user/login");
                }

                
            }
                
            
        }
    }
}